package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;
import static com.cnswhy.cloud.common.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author cnswhy
 * @since 2020-09-30
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_spread_log")
@ApiModel(value = "SpreadLog", description = "")
public class SpreadLog implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "")
    @NotNull(message = "不能为空")
    @TableId(value = "id", type = IdType.AUTO)
    @Excel(name = "")
    private Long id;

    @ApiModelProperty(value = "")
    @NotNull(message = "不能为空")
    @TableField("customer_id")
    @Excel(name = "")
    private Long customerId;

    @ApiModelProperty(value = "")
    @Length(max = 11, message = "长度不能超过11")
    @TableField(value = "mobile", condition = LIKE)
    @Excel(name = "")
    private String mobile;

    @ApiModelProperty(value = "")
    @TableField("amount")
    @Excel(name = "")
    private BigDecimal amount;

    /**
     * 1爱心收益2贡献收益3拼团收益4订单回购5爱心收益转余额6贡献收益转余额7拼团收益转余额8分享红包9分享红包转余额10拼购券转余额
     */
    @ApiModelProperty(value = "1爱心收益2贡献收益3拼团收益4订单回购5爱心收益转余额6贡献收益转余额7拼团收益转余额8分享红包9分享红包转余额10拼购券转余额11拼团12拼团失败13队长分红转账14队长分红")
    @TableField("type")
    @Excel(name = "1爱心收益2贡献收益3拼团收益4订单回购5爱心收益转余额6贡献收益转余额7拼团收益转余额8分享红包9分享红包转余额10拼购券转余额11拼团12拼团失败13队长分红转账14队长分红")
    private Integer type;

    @ApiModelProperty(value = "")
    @Length(max = 50, message = "长度不能超过50")
    @TableField(value = "order_num", condition = LIKE)
    @Excel(name = "")
    private String orderNum;

    @ApiModelProperty(value = "")
    @TableField("share_customer_id")
    @Excel(name = "")
    private Long shareCustomerId;

    @ApiModelProperty(value = "")
    @Length(max = 11, message = "长度不能超过11")
    @TableField(value = "share_mobile", condition = LIKE)
    @Excel(name = "")
    private String shareMobile;

    @ApiModelProperty(value = "")
    //@TableField(value = "create_date", fill = FieldFill.INSERT)
    @Excel(name = "", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime createDate;

    @ApiModelProperty(value = "")
    @TableField("balance")
    @Excel(name = "")
    private BigDecimal balance;


    @ApiModelProperty(value = "")
    @TableField("sett_date")
    @Excel(name = "")
    private String settDate;

    @Builder
    public SpreadLog(
            Long id, Long customerId, String mobile, BigDecimal amount, Integer type,
            String orderNum, Long shareCustomerId, String shareMobile, LocalDateTime createDate, BigDecimal balance, String settDate) {
        this.id = id;
        this.customerId = customerId;
        this.mobile = mobile;
        this.amount = amount;
        this.type = type;
        this.orderNum = orderNum;
        this.shareCustomerId = shareCustomerId;
        this.shareMobile = shareMobile;
        this.createDate = createDate;
        this.balance = balance;
        this.settDate = settDate;
    }

}
